package br.usp.ipq.extgwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.core.Function;
import com.gwtext.client.widgets.MessageBox;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Tool;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class ExtGWT implements EntryPoint {

  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
		final Panel myPanel = new Panel();
		myPanel.setWidth(300);
		myPanel.setHeight(200);
		myPanel.setFrame(false); // Optional
		myPanel.setTitle("Panel Example");
		myPanel.addTool(new Tool(Tool.GEAR, new Function() {
			public void execute() {
				MessageBox.alert("Gear Tool", "This Panel is "
						+ (myPanel.isCollapsed() ? "" : "not") + " collapsed");
			}
		}, "Gear"));
		myPanel.addTool(new Tool(Tool.PIN, new Function() {
			public void execute() {
				if (myPanel.isFrame())
					myPanel.setFrame(false);
				else
					myPanel.setFrame(true);
			}
		}, "Pin"));
		myPanel.addTool(new Tool(Tool.TOGGLE, new Function() {
			public void execute() {
				if (myPanel.isCollapsed()) {
					myPanel.expand(true);
				} else {
					myPanel.collapse(true);
				}
			}
		}, "Collapse"));
	 
		RootPanel.get().add(myPanel);
  }
}
